Optimal. Leaf size=287 \[ \frac {2 b^2 (e f-d g)^2 n^2 x}{e^2}+\frac {b^2 g (e f-d g) n^2 (d+e x)^2}{2 e^3}+\frac {2 b^2 g^2 n^2 (d+e x)^3}{27 e^3}+\frac {b^2 (e f-d g)^3 n^2 \log ^2(d+e x)}{3 e^3 g}-\frac {2 b (e f-d g)^2 n (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )}{e^3}-\frac {b g (e f-d g) n (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )}{e^3}-\frac {2 b g^2 n (d+e x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{9 e^3}-\frac {2 b (e f-d g)^3 n \log (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 e^3 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.28, antiderivative size = 287, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.292, Rules used = {2445, 2458, 45,
2372, 12, 14, 2338} \begin {gather*} -\frac {2 b n (e f-d g)^3 \log (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 e^3 g}-\frac {2 b n (d+e x) (e f-d g)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )}{e^3}-\frac {b g n (d+e x)^2 (e f-d g) \left (a+b \log \left (c (d+e x)^n\right )\right )}{e^3}-\frac {2 b g^2 n (d+e x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{9 e^3}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}+\frac {b^2 g n^2 (d+e x)^2 (e f-d g)}{2 e^3}+\frac {b^2 n^2 (e f-d g)^3 \log ^2(d+e x)}{3 e^3 g}+\frac {2 b^2 g^2 n^2 (d+e x)^3}{27 e^3}+\frac {2 b^2 n^2 x (e f-d g)^2}{e^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 14
Rule 45
Rule 2338
Rule 2372
Rule 2445
Rule 2458
Rubi steps
\begin {align*} \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx &=\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}-\frac {(2 b e n) \int \frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{d+e x} \, dx}{3 g}\\ &=\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}-\frac {(2 b n) \text {Subst}\left (\int \frac {\left (\frac {e f-d g}{e}+\frac {g x}{e}\right )^3 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx,x,d+e x\right )}{3 g}\\ &=-\frac {b n \left (\frac {18 g (e f-d g)^2 (d+e x)}{e^3}+\frac {9 g^2 (e f-d g) (d+e x)^2}{e^3}+\frac {2 g^3 (d+e x)^3}{e^3}+\frac {6 (e f-d g)^3 \log (d+e x)}{e^3}\right ) \left (a+b \log \left (c (d+e x)^n\right )\right )}{9 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}+\frac {\left (2 b^2 n^2\right ) \text {Subst}\left (\int \frac {g x \left (18 e^2 f^2+9 e f g (-4 d+x)+g^2 \left (18 d^2-9 d x+2 x^2\right )\right )+6 (e f-d g)^3 \log (x)}{6 e^3 x} \, dx,x,d+e x\right )}{3 g}\\ &=-\frac {b n \left (\frac {18 g (e f-d g)^2 (d+e x)}{e^3}+\frac {9 g^2 (e f-d g) (d+e x)^2}{e^3}+\frac {2 g^3 (d+e x)^3}{e^3}+\frac {6 (e f-d g)^3 \log (d+e x)}{e^3}\right ) \left (a+b \log \left (c (d+e x)^n\right )\right )}{9 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}+\frac {\left (b^2 n^2\right ) \text {Subst}\left (\int \frac {g x \left (18 e^2 f^2+9 e f g (-4 d+x)+g^2 \left (18 d^2-9 d x+2 x^2\right )\right )+6 (e f-d g)^3 \log (x)}{x} \, dx,x,d+e x\right )}{9 e^3 g}\\ &=-\frac {b n \left (\frac {18 g (e f-d g)^2 (d+e x)}{e^3}+\frac {9 g^2 (e f-d g) (d+e x)^2}{e^3}+\frac {2 g^3 (d+e x)^3}{e^3}+\frac {6 (e f-d g)^3 \log (d+e x)}{e^3}\right ) \left (a+b \log \left (c (d+e x)^n\right )\right )}{9 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}+\frac {\left (b^2 n^2\right ) \text {Subst}\left (\int \left (g \left (18 (e f-d g)^2+9 g (e f-d g) x+2 g^2 x^2\right )+\frac {6 (e f-d g)^3 \log (x)}{x}\right ) \, dx,x,d+e x\right )}{9 e^3 g}\\ &=-\frac {b n \left (\frac {18 g (e f-d g)^2 (d+e x)}{e^3}+\frac {9 g^2 (e f-d g) (d+e x)^2}{e^3}+\frac {2 g^3 (d+e x)^3}{e^3}+\frac {6 (e f-d g)^3 \log (d+e x)}{e^3}\right ) \left (a+b \log \left (c (d+e x)^n\right )\right )}{9 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}+\frac {\left (b^2 n^2\right ) \text {Subst}\left (\int \left (18 (e f-d g)^2+9 g (e f-d g) x+2 g^2 x^2\right ) \, dx,x,d+e x\right )}{9 e^3}+\frac {\left (2 b^2 (e f-d g)^3 n^2\right ) \text {Subst}\left (\int \frac {\log (x)}{x} \, dx,x,d+e x\right )}{3 e^3 g}\\ &=\frac {2 b^2 (e f-d g)^2 n^2 x}{e^2}+\frac {b^2 g (e f-d g) n^2 (d+e x)^2}{2 e^3}+\frac {2 b^2 g^2 n^2 (d+e x)^3}{27 e^3}+\frac {b^2 (e f-d g)^3 n^2 \log ^2(d+e x)}{3 e^3 g}-\frac {b n \left (\frac {18 g (e f-d g)^2 (d+e x)}{e^3}+\frac {9 g^2 (e f-d g) (d+e x)^2}{e^3}+\frac {2 g^3 (d+e x)^3}{e^3}+\frac {6 (e f-d g)^3 \log (d+e x)}{e^3}\right ) \left (a+b \log \left (c (d+e x)^n\right )\right )}{9 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{3 g}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.25, size = 400, normalized size = 1.39 \begin {gather*} \frac {-18 b^2 d \left (3 e^2 f^2-3 d e f g+d^2 g^2\right ) n^2 \log ^2(d+e x)+6 b d n \log (d+e x) \left (6 a \left (3 e^2 f^2-3 d e f g+d^2 g^2\right )+b \left (-18 e^2 f^2+27 d e f g-11 d^2 g^2\right ) n+6 b \left (3 e^2 f^2-3 d e f g+d^2 g^2\right ) \log \left (c (d+e x)^n\right )\right )+e x \left (18 a^2 e^2 \left (3 f^2+3 f g x+g^2 x^2\right )-6 a b n \left (6 d^2 g^2-3 d e g (6 f+g x)+e^2 \left (18 f^2+9 f g x+2 g^2 x^2\right )\right )+b^2 n^2 \left (66 d^2 g^2-3 d e g (54 f+5 g x)+e^2 \left (108 f^2+27 f g x+4 g^2 x^2\right )\right )+6 b \left (6 a e^2 \left (3 f^2+3 f g x+g^2 x^2\right )-b n \left (6 d^2 g^2-3 d e g (6 f+g x)+e^2 \left (18 f^2+9 f g x+2 g^2 x^2\right )\right )\right ) \log \left (c (d+e x)^n\right )+18 b^2 e^2 \left (3 f^2+3 f g x+g^2 x^2\right ) \log ^2\left (c (d+e x)^n\right )\right )}{54 e^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [C] Result contains higher order function than in optimal. Order 9 vs. order
3.
time = 1.00, size = 4597, normalized size = 16.02
method | result | size |
risch | \(\text {Expression too large to display}\) | \(4597\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.32, size = 567, normalized size = 1.98 \begin {gather*} \frac {1}{3} \, b^{2} g^{2} x^{3} \log \left ({\left (x e + d\right )}^{n} c\right )^{2} + \frac {2}{3} \, a b g^{2} x^{3} \log \left ({\left (x e + d\right )}^{n} c\right ) + b^{2} f g x^{2} \log \left ({\left (x e + d\right )}^{n} c\right )^{2} + \frac {1}{3} \, a^{2} g^{2} x^{3} + 2 \, {\left (d e^{\left (-2\right )} \log \left (x e + d\right ) - x e^{\left (-1\right )}\right )} a b f^{2} n e - {\left (2 \, d^{2} e^{\left (-3\right )} \log \left (x e + d\right ) + {\left (x^{2} e - 2 \, d x\right )} e^{\left (-2\right )}\right )} a b f g n e + \frac {1}{9} \, {\left (6 \, d^{3} e^{\left (-4\right )} \log \left (x e + d\right ) - {\left (2 \, x^{3} e^{2} - 3 \, d x^{2} e + 6 \, d^{2} x\right )} e^{\left (-3\right )}\right )} a b g^{2} n e + 2 \, a b f g x^{2} \log \left ({\left (x e + d\right )}^{n} c\right ) + b^{2} f^{2} x \log \left ({\left (x e + d\right )}^{n} c\right )^{2} + a^{2} f g x^{2} + 2 \, a b f^{2} x \log \left ({\left (x e + d\right )}^{n} c\right ) - {\left ({\left (d \log \left (x e + d\right )^{2} - 2 \, x e + 2 \, d \log \left (x e + d\right )\right )} n^{2} e^{\left (-1\right )} - 2 \, {\left (d e^{\left (-2\right )} \log \left (x e + d\right ) - x e^{\left (-1\right )}\right )} n e \log \left ({\left (x e + d\right )}^{n} c\right )\right )} b^{2} f^{2} + \frac {1}{2} \, {\left ({\left (2 \, d^{2} \log \left (x e + d\right )^{2} + x^{2} e^{2} - 6 \, d x e + 6 \, d^{2} \log \left (x e + d\right )\right )} n^{2} e^{\left (-2\right )} - 2 \, {\left (2 \, d^{2} e^{\left (-3\right )} \log \left (x e + d\right ) + {\left (x^{2} e - 2 \, d x\right )} e^{\left (-2\right )}\right )} n e \log \left ({\left (x e + d\right )}^{n} c\right )\right )} b^{2} f g - \frac {1}{54} \, {\left ({\left (18 \, d^{3} \log \left (x e + d\right )^{2} - 4 \, x^{3} e^{3} + 15 \, d x^{2} e^{2} - 66 \, d^{2} x e + 66 \, d^{3} \log \left (x e + d\right )\right )} n^{2} e^{\left (-3\right )} - 6 \, {\left (6 \, d^{3} e^{\left (-4\right )} \log \left (x e + d\right ) - {\left (2 \, x^{3} e^{2} - 3 \, d x^{2} e + 6 \, d^{2} x\right )} e^{\left (-3\right )}\right )} n e \log \left ({\left (x e + d\right )}^{n} c\right )\right )} b^{2} g^{2} + a^{2} f^{2} x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 709 vs.
\(2 (284) = 568\).
time = 0.38, size = 709, normalized size = 2.47 \begin {gather*} \frac {1}{54} \, {\left (18 \, {\left (b^{2} g^{2} x^{3} + 3 \, b^{2} f g x^{2} + 3 \, b^{2} f^{2} x\right )} e^{3} \log \left (c\right )^{2} + 6 \, {\left (11 \, b^{2} d^{2} g^{2} n^{2} - 6 \, a b d^{2} g^{2} n\right )} x e + 18 \, {\left (b^{2} d^{3} g^{2} n^{2} - 3 \, b^{2} d^{2} f g n^{2} e + 3 \, b^{2} d f^{2} n^{2} e^{2} + {\left (b^{2} g^{2} n^{2} x^{3} + 3 \, b^{2} f g n^{2} x^{2} + 3 \, b^{2} f^{2} n^{2} x\right )} e^{3}\right )} \log \left (x e + d\right )^{2} + {\left (2 \, {\left (2 \, b^{2} g^{2} n^{2} - 6 \, a b g^{2} n + 9 \, a^{2} g^{2}\right )} x^{3} + 27 \, {\left (b^{2} f g n^{2} - 2 \, a b f g n + 2 \, a^{2} f g\right )} x^{2} + 54 \, {\left (2 \, b^{2} f^{2} n^{2} - 2 \, a b f^{2} n + a^{2} f^{2}\right )} x\right )} e^{3} - 3 \, {\left ({\left (5 \, b^{2} d g^{2} n^{2} - 6 \, a b d g^{2} n\right )} x^{2} + 18 \, {\left (3 \, b^{2} d f g n^{2} - 2 \, a b d f g n\right )} x\right )} e^{2} - 6 \, {\left (11 \, b^{2} d^{3} g^{2} n^{2} - 6 \, a b d^{3} g^{2} n + {\left (2 \, {\left (b^{2} g^{2} n^{2} - 3 \, a b g^{2} n\right )} x^{3} + 9 \, {\left (b^{2} f g n^{2} - 2 \, a b f g n\right )} x^{2} + 18 \, {\left (b^{2} f^{2} n^{2} - a b f^{2} n\right )} x\right )} e^{3} - 3 \, {\left (b^{2} d g^{2} n^{2} x^{2} + 6 \, b^{2} d f g n^{2} x - 6 \, b^{2} d f^{2} n^{2} + 6 \, a b d f^{2} n\right )} e^{2} + 3 \, {\left (2 \, b^{2} d^{2} g^{2} n^{2} x - 9 \, b^{2} d^{2} f g n^{2} + 6 \, a b d^{2} f g n\right )} e - 6 \, {\left (b^{2} d^{3} g^{2} n - 3 \, b^{2} d^{2} f g n e + 3 \, b^{2} d f^{2} n e^{2} + {\left (b^{2} g^{2} n x^{3} + 3 \, b^{2} f g n x^{2} + 3 \, b^{2} f^{2} n x\right )} e^{3}\right )} \log \left (c\right )\right )} \log \left (x e + d\right ) - 6 \, {\left (6 \, b^{2} d^{2} g^{2} n x e + {\left (2 \, {\left (b^{2} g^{2} n - 3 \, a b g^{2}\right )} x^{3} + 9 \, {\left (b^{2} f g n - 2 \, a b f g\right )} x^{2} + 18 \, {\left (b^{2} f^{2} n - a b f^{2}\right )} x\right )} e^{3} - 3 \, {\left (b^{2} d g^{2} n x^{2} + 6 \, b^{2} d f g n x\right )} e^{2}\right )} \log \left (c\right )\right )} e^{\left (-3\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 774 vs.
\(2 (274) = 548\).
time = 1.31, size = 774, normalized size = 2.70 \begin {gather*} \begin {cases} a^{2} f^{2} x + a^{2} f g x^{2} + \frac {a^{2} g^{2} x^{3}}{3} + \frac {2 a b d^{3} g^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{3 e^{3}} - \frac {2 a b d^{2} f g \log {\left (c \left (d + e x\right )^{n} \right )}}{e^{2}} - \frac {2 a b d^{2} g^{2} n x}{3 e^{2}} + \frac {2 a b d f^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{e} + \frac {2 a b d f g n x}{e} + \frac {a b d g^{2} n x^{2}}{3 e} - 2 a b f^{2} n x + 2 a b f^{2} x \log {\left (c \left (d + e x\right )^{n} \right )} - a b f g n x^{2} + 2 a b f g x^{2} \log {\left (c \left (d + e x\right )^{n} \right )} - \frac {2 a b g^{2} n x^{3}}{9} + \frac {2 a b g^{2} x^{3} \log {\left (c \left (d + e x\right )^{n} \right )}}{3} - \frac {11 b^{2} d^{3} g^{2} n \log {\left (c \left (d + e x\right )^{n} \right )}}{9 e^{3}} + \frac {b^{2} d^{3} g^{2} \log {\left (c \left (d + e x\right )^{n} \right )}^{2}}{3 e^{3}} + \frac {3 b^{2} d^{2} f g n \log {\left (c \left (d + e x\right )^{n} \right )}}{e^{2}} - \frac {b^{2} d^{2} f g \log {\left (c \left (d + e x\right )^{n} \right )}^{2}}{e^{2}} + \frac {11 b^{2} d^{2} g^{2} n^{2} x}{9 e^{2}} - \frac {2 b^{2} d^{2} g^{2} n x \log {\left (c \left (d + e x\right )^{n} \right )}}{3 e^{2}} - \frac {2 b^{2} d f^{2} n \log {\left (c \left (d + e x\right )^{n} \right )}}{e} + \frac {b^{2} d f^{2} \log {\left (c \left (d + e x\right )^{n} \right )}^{2}}{e} - \frac {3 b^{2} d f g n^{2} x}{e} + \frac {2 b^{2} d f g n x \log {\left (c \left (d + e x\right )^{n} \right )}}{e} - \frac {5 b^{2} d g^{2} n^{2} x^{2}}{18 e} + \frac {b^{2} d g^{2} n x^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{3 e} + 2 b^{2} f^{2} n^{2} x - 2 b^{2} f^{2} n x \log {\left (c \left (d + e x\right )^{n} \right )} + b^{2} f^{2} x \log {\left (c \left (d + e x\right )^{n} \right )}^{2} + \frac {b^{2} f g n^{2} x^{2}}{2} - b^{2} f g n x^{2} \log {\left (c \left (d + e x\right )^{n} \right )} + b^{2} f g x^{2} \log {\left (c \left (d + e x\right )^{n} \right )}^{2} + \frac {2 b^{2} g^{2} n^{2} x^{3}}{27} - \frac {2 b^{2} g^{2} n x^{3} \log {\left (c \left (d + e x\right )^{n} \right )}}{9} + \frac {b^{2} g^{2} x^{3} \log {\left (c \left (d + e x\right )^{n} \right )}^{2}}{3} & \text {for}\: e \neq 0 \\\left (a + b \log {\left (c d^{n} \right )}\right )^{2} \left (f^{2} x + f g x^{2} + \frac {g^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 1339 vs.
\(2 (284) = 568\).
time = 6.16, size = 1339, normalized size = 4.67 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.55, size = 591, normalized size = 2.06 \begin {gather*} \ln \left (c\,{\left (d+e\,x\right )}^n\right )\,\left (\frac {x^2\,\left (\frac {3\,b\,g\,\left (a\,d\,g+2\,a\,e\,f-b\,e\,f\,n\right )}{e}-\frac {b\,d\,g^2\,\left (3\,a-b\,n\right )}{e}\right )}{3}-\frac {x\,\left (\frac {d\,\left (\frac {18\,b\,g\,\left (a\,d\,g+2\,a\,e\,f-b\,e\,f\,n\right )}{e}-\frac {6\,b\,d\,g^2\,\left (3\,a-b\,n\right )}{e}\right )}{3\,e}-\frac {6\,b\,f\,\left (2\,a\,d\,g+a\,e\,f-b\,e\,f\,n\right )}{e}\right )}{3}+\frac {2\,b\,g^2\,x^3\,\left (3\,a-b\,n\right )}{9}\right )+x\,\left (\frac {18\,a^2\,d\,e\,f\,g+9\,a^2\,e^2\,f^2-18\,a\,b\,e^2\,f^2\,n+6\,b^2\,d^2\,g^2\,n^2-18\,b^2\,d\,e\,f\,g\,n^2+18\,b^2\,e^2\,f^2\,n^2}{9\,e^2}-\frac {d\,\left (\frac {g\,\left (3\,a^2\,d\,g+6\,a^2\,e\,f-b^2\,d\,g\,n^2+3\,b^2\,e\,f\,n^2-6\,a\,b\,e\,f\,n\right )}{3\,e}-\frac {d\,g^2\,\left (9\,a^2-6\,a\,b\,n+2\,b^2\,n^2\right )}{9\,e}\right )}{e}\right )+x^2\,\left (\frac {g\,\left (3\,a^2\,d\,g+6\,a^2\,e\,f-b^2\,d\,g\,n^2+3\,b^2\,e\,f\,n^2-6\,a\,b\,e\,f\,n\right )}{6\,e}-\frac {d\,g^2\,\left (9\,a^2-6\,a\,b\,n+2\,b^2\,n^2\right )}{18\,e}\right )+{\ln \left (c\,{\left (d+e\,x\right )}^n\right )}^2\,\left (b^2\,f^2\,x+\frac {b^2\,g^2\,x^3}{3}+\frac {d\,\left (b^2\,d^2\,g^2-3\,b^2\,d\,e\,f\,g+3\,b^2\,e^2\,f^2\right )}{3\,e^3}+b^2\,f\,g\,x^2\right )-\frac {\ln \left (d+e\,x\right )\,\left (11\,b^2\,d^3\,g^2\,n^2-27\,b^2\,d^2\,e\,f\,g\,n^2+18\,b^2\,d\,e^2\,f^2\,n^2-6\,a\,b\,d^3\,g^2\,n+18\,a\,b\,d^2\,e\,f\,g\,n-18\,a\,b\,d\,e^2\,f^2\,n\right )}{9\,e^3}+\frac {g^2\,x^3\,\left (9\,a^2-6\,a\,b\,n+2\,b^2\,n^2\right )}{27} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________